#include <iostream>
using namespace std;
int mym(int vector[],int cantidad,char signo);
int main()
{

     int i,n,mayor,menor;
     int vector [50];
     i=0;

    while(i<50)
    {
        cin>>vector[i];
        if(vector[i]!=0)
        {
            i++;
        }
        else
        {
            break;
        }

    }

    cout<<mym(vector,i,'<')<<endl;
    cout<<mym(vector,i,'>')<<endl;


}

int mym(int vector[],int cantidad,char signo)
{
    int m;
    int i;
    m=vector[0];
    i=0;

    while(i<cantidad)
    {
        if(signo=='<')
        {
            if (vector[i]<m)
            m=vector[i];
        }else
        {
            if (vector[i]>m)
            m=vector[i];
        }

        i++;


    }
    return m;


}
